package com.dji.ux.sample.MediaManager;

public class MediaEvent {


    private int progress;

    private DOWNLOAD_STATUS downloadState;

    MediaEvent() {
        this.progress = 0;
        this.downloadState = DOWNLOAD_STATUS.NOT_EXECUTING;
    }
    @Override
    public String toString() {
        return "MediaEvent{" +
                "progress=" + progress +
                ", downloadState=" + downloadState +
                '}';
    }

    public static enum DOWNLOAD_STATUS {
        NOT_EXECUTING("未开始"),
        ON_START("准备开始"),
        DOWNLOADING("正在下载"),
        SUCCESS("下载成功");
        private String typeName;

        DOWNLOAD_STATUS(String typeName) {
            this.typeName = typeName;
        }

        /**
         * 根据类型的名称，返回类型的枚举实例。
         *
         * @param typeName 类型名称
         */
        public static DOWNLOAD_STATUS fromTypeName(String typeName) {
            for (DOWNLOAD_STATUS type : DOWNLOAD_STATUS.values()) {
                if (type.getTypeName().equals(typeName)) {
                    return type;
                }
            }
            return null;
        }

        public static String getTypeNameByValue(DOWNLOAD_STATUS download_status) {
            for (DOWNLOAD_STATUS type : DOWNLOAD_STATUS.values()) {
                if (download_status.equals(type)) {
                    return type.getTypeName();
                }
            }
            return null;
        }

        public String getTypeName() {
            return this.typeName;
        }

    }

    public DOWNLOAD_STATUS getDownloadState() {
        return downloadState;
    }

    public void setDownloadState(DOWNLOAD_STATUS downloadState) {
        this.downloadState = downloadState;
    }

    public int getProgress() {
        return progress;
    }

    public void setProgress(int progress) {
        this.progress = progress;
    }


}
